# !/usr/bin python3
# encoding: utf-8 -*-
# @file     : order_page.py
# @author   : 沙陌 Matongxue_2
# @Time     : 2023/9/5 22:00
# @Copyright: 北京码同学
import time

from pages.base_page import BuyerBasePage


class OrderCheckoutPage(BuyerBasePage):

    def click_first_address(self):
        ele_info = self.page_eles['第一个收货地址']
        self.operate.click(ele_info)
        return self

    def click_huodao_pay(self):
        ele_info = self.page_eles['货到付款']
        self.operate.click(ele_info)
        return self

    def click_online_pay(self):
        ele_info = self.page_eles['在线支付']
        self.operate.click(ele_info)
        return self

    def click_any_time(self):
        ele_info = self.page_eles['任意时间']
        self.operate.click(ele_info)
        return self

    def click_only_work(self):
        ele_info = self.page_eles['仅工作日']
        self.operate.click(ele_info)
        return self

    def click_only_not_work(self):
        ele_info = self.page_eles['仅休息日']
        self.operate.click(ele_info)
        return self

    def click_submit_order(self):
        ele_info = self.page_eles['提交订单']
        self.operate.click(ele_info)
        return OrderSuccessPage()


class OrderSuccessPage(BuyerBasePage):

    def get_order_sn(self):
        time.sleep(2)
        ele_info = self.page_eles['交易号']
        return self.operate.get_text(ele_info)
